/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package components.shapemenu;

/**
 *
 * @author icdev
 */
import components.shape.Shape;
import java.io.Serializable;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.JSeparator;

public class ShapeMenu extends JPopupMenu implements Serializable {

    JMenuItem deleteItem;
    JCheckBoxMenuItem moveItem;
    JMenuItem resetItem;
    JMenuItem bringToFrontItem;
    JMenuItem sendToBackItem;
    JMenuItem brightnessItem;
    JSeparator jsep2;

    public ShapeMenu() {
        super();
        MenuAction mAction = new MenuAction();
        CheckMenuAction cmAction = new CheckMenuAction();

        deleteItem = new JMenuItem("Delete");
        moveItem = new JCheckBoxMenuItem("Lock");
        resetItem = new JMenuItem("Change Shape");
        JSeparator jsep1 = new JSeparator();
        bringToFrontItem = new JMenuItem("Bring to Front");
        sendToBackItem = new JMenuItem("Send to Back");
        brightnessItem = new JMenuItem("Brightness");
        deleteItem.addActionListener(mAction);
        moveItem.addActionListener(cmAction);
        resetItem.addActionListener(mAction);
        jsep2 = new JSeparator();
        brightnessItem.addActionListener(mAction);
        this.addPopupMenuListener(new ShapeMenuActions());
        if (currentBand != null) {
            moveItem.setSelected(!currentBand.isMovable());
        }

        this.add(deleteItem);
        this.add(moveItem);
        this.add(resetItem);
        this.add(jsep1);
        this.add(bringToFrontItem);
        this.add(sendToBackItem);
        this.add(jsep2);
        this.add(brightnessItem);

    }

    public void setBrightnessItemAvilabelity(boolean avilable) {
        this.brightnessItem.setVisible(avilable);
        this.jsep2.setVisible(avilable);
    }

    public JMenuItem getBrightnessItem() {
        return brightnessItem;
    }

    public JMenuItem getDeleteItem() {
        return deleteItem;
    }

    public JCheckBoxMenuItem getMoveItem() {
        return moveItem;
    }

    public JMenuItem getResetItem() {
        return resetItem;
    }

    public JMenuItem getBringtoFrontItem() {
        return bringToFrontItem;
    }

    public JMenuItem getSendtoBack() {
        return sendToBackItem;
    }
    Shape currentBand;

    public void setCurrentBand(Shape com) {
        currentBand = com;
    }

    public Shape getCurrentBand() {
        return currentBand;
    }
}